<!--Copyright (C) Kherty.  All rights reserved.-->
<os:RibbonWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
    xmlns:oui="http://schemas.Kherty.com/office/2007"
    xmlns:os="clr-namespace:OpenLS.UI;assembly=OpenLS.UI"
    xmlns:drawings="http://schemas.Kherty.com/office/2007/drawing"
    xmlns:media="http://schemas.Kherty.com/office/2007/media"
   xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
   xmlns:dxe="clr-namespace:DevExpress.Xpf.Editors;assembly=DevExpress.Xpf.Core.v12.1"
   x:Class="OpenLS.Spreadsheet.UI.SpreadsheetWindow"
   Loaded="onLoaded"
    TextElement.FontFamily="Segoe UI"
    TextElement.FontSize="12"
    Title="{Binding /Name}"
    Icon ="spreadsheet.ico" FocusManager.FocusedElement="{Binding ElementName=workbookControl}"
    ResizeMode="CanResizeWithGrip"
    Closing="onClosing"
    Drop="onDrop"
    Background="#A4C3EB"
    ssui:SpreadsheetElement.Workbook="{Binding /Document.Workbook}" Padding="0,0,0,30"
    >
    
    <os:RibbonWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ssui:DocumentsResources/>
                <drawings:ShapeResources/>
                <drawings:ConnectorResources/>
                <os:OfficeResources/>
                <ssui:WorksheetDrawingResources/>
                <os:SliderResources/>
                <ssui:SpreadsheetApplicationMenuResources/>
                <ssui:SpreadsheetQuickAccessToolbar />
                <ssui:SpreadsheetStatusBar />
                <!--
                <oui:ApplicationMenuResources/>
                <oui:OfficeWindowResources/>
                -->
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </os:RibbonWindow.Resources>
    <os:RibbonWindow.CommandBindings>
        <CommandBinding Command="{x:Static ApplicationCommands.Close}" Executed="onClose" CanExecute ="onCanSave"/>
        <CommandBinding Executed="onNew" Command="{x:Static ApplicationCommands.New}"/>
        <CommandBinding Executed="onOpen" Command="{x:Static ApplicationCommands.Open}"/>
        <CommandBinding Executed="onSave" CanExecute="onCanSave" Command="{x:Static ApplicationCommands.Save}"/>
        <CommandBinding Executed="onSaveAs" CanExecute="onCanSave" Command="{x:Static ApplicationCommands.SaveAs}"/>
        <CommandBinding Executed="onSaveAsXps" CanExecute="onCanSave" Command="{x:Static ssui:SpreadsheetCommands.SaveAsXps}"/>
        <CommandBinding Executed="onPrint" CanExecute="onCanSave" Command="{x:Static ApplicationCommands.Print}"/>
        <CommandBinding Executed="onPrintPreview" CanExecute="onCanSave" Command="{x:Static ApplicationCommands.PrintPreview}"/>
        <CommandBinding Executed="onExit" CanExecute="onAlways" Command="{x:Static os:OfficeApplicationCommands.Exit}"/>
        <CommandBinding Executed="onOptions" CanExecute="onAlways" Command="{x:Static os:OfficeApplicationCommands.Options}"/>
        <CommandBinding Executed="onSwitchWindow" CanExecute="onAlways" Command="{x:Static ssui:SpreadsheetCommands.SwitchWindow}"/>
    </os:RibbonWindow.CommandBindings>
    <os:RibbonWindow.InputBindings>
        <KeyBinding Key="F12" Command ="{x:Static ApplicationCommands.SaveAs}" />
        <KeyBinding Key="F12" Command ="{x:Static ApplicationCommands.Save}" Modifiers="Shift"/>
        <KeyBinding Key="F12" Command ="{x:Static ApplicationCommands.Open}" Modifiers="Control"/>
    </os:RibbonWindow.InputBindings>
    <os:RibbonElement.IconProvider>
        <media:IconProvider/>
    </os:RibbonElement.IconProvider>
    <os:RibbonWindow.QuickAccessToolbar>
        <StaticResource ResourceKey="{x:Static ssui:SpreadsheetWindowComponents.QuickAccessToolbarKey}"/>
    </os:RibbonWindow.QuickAccessToolbar>
    <os:RibbonWindow.Ribbon>
        <ssui:SpreadsheetRibbon os:Ribbon.ApplicationMenu="{StaticResource {x:Static ssui:SpreadsheetWindowComponents.ApplicationMenuKey}}" DataContext="{Binding /Document.Workbook}"/>
    </os:RibbonWindow.Ribbon>
    <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="1" />
                <RowDefinition Height="*" />
                <RowDefinition Height="30" />
            </Grid.RowDefinitions>
        <dxdo:DockLayoutManager x:Name="DemoDockContainer" Grid.Row="1" FloatingMode="Desktop">
            <!--
        <dxdo:DockLayoutManager.AutoHideGroups>
            <dxdo:AutoHideGroup ItemWidth="Auto" AutoHideSize="300,300">
                <dxdo:LayoutPanel Caption="Module developer view" ItemWidth="Auto">
                    <Views:ModuleCodeBrowser></Views:ModuleCodeBrowser>
                </dxdo:LayoutPanel>
          
                <dxdo:LayoutPanel Caption="Web connector" ItemWidth="Auto">
                    <BrowserScrapper:BrowserScrapper></BrowserScrapper:BrowserScrapper>
                </dxdo:LayoutPanel>
               
            </dxdo:AutoHideGroup>
        </dxdo:DockLayoutManager.AutoHideGroups>
        -->
            <dxdo:LayoutGroup ShowCaption="True" Padding="0,0,0,25">
                <dxdo:LayoutGroup Orientation="Vertical" Name="SpreadsheetContentGroup" ItemWidth="5*">
                    <!--
                <dxdo:LayoutGroup Orientation="Horizontal">
                    <dxdo:LayoutPanel Name="diagramToolbox" Caption="Kloudi spreadsheet items" HeaderBarContainerControlName="Toolbox" ItemWidth="1*">
                        <s:DiagramToolboxControl x:Name="diagramToolboxControl" />
                    </dxdo:LayoutPanel>
                    <dxdo:TabbedGroup Name="SpreadsheetDefinitionGroup" ItemHeight="150">
                        <dxdo:LayoutPanel Name="diagramDesigner1" Caption="Spreadsheet items" HeaderBarContainerControlName="Designer" ItemWidth="5*">
                            <s:DiagramControl x:Name="diagramControl"/>
                        </dxdo:LayoutPanel>
                        <dxdo:LayoutPanel Name="TimelineItem" Caption="Spreadsheet timeline" HeaderBarContainerControlName="Designer" ItemWidth="5*">
                            <StackPanel VerticalAlignment="Stretch"
                Orientation="Vertical">
                                <GroupBox Header="Timelines">
                                    <StackPanel Orientation="Vertical">
                                        <TextBlock Text="Right click and drag to edit items.  Left Edge - moves start time.  Right Edge - moves end time." />
                                        <TextBlock Text="If you are moving the scene you will push other scenes when you run into them." />
                                        <TextBlock Text="If you are editing an edge, it will stop when you run into a neighbor scene.  Hold ctrl to link to a touching edge and move them together." />
                                        <TextBlock Text="You can drag and drop with left click to change order or move from one timeline to the next." />
                                        <GroupBox Header="Single Time Line Thread">

                                            <StackPanel Orientation="Vertical">
                                                <ScrollViewer HorizontalAlignment="Stretch"
                                      HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Auto"
                                      VerticalAlignment="Stretch"
                                      x:Name="FoundMe">
                                                    <StackPanel Orientation="Vertical">
                                              
                                                        <ItemsControl>
                                                           
                                                            <tt:TimeLineControl Height="80"
                                                        ItemTemplate="{StaticResource UsedTemplateProperty}"
                                                        HorizontalAlignment="Left"
                                                        x:Name="TimeLine2"
                                                        UnitSize="20"
                                                        MinimumUnitWidth="20"
                                                        Background="AntiqueWhite"
                                                        DrawTimeGrid="True"
                                                        MinWidth="50"
                                                        SynchedWithSiblings="True" />
                                                            <tt:TimeLineControl Height="80"
                                                        ItemTemplate="{StaticResource UsedTemplateProperty}"
                                                        HorizontalAlignment="Left"
                                                        x:Name="TimeLine3"
                                                        UnitSize="20"
                                                        MinimumUnitWidth="20"
                                                        Background="Azure"
                                                        DrawTimeGrid="True"
                                                        MinWidth="50"
                                                        SynchedWithSiblings="True" />
                                              
                                                        </ItemsControl>
                                                    </StackPanel>
                                                </ScrollViewer>

                                            </StackPanel>

                                        </GroupBox>
                                        <TextBlock Text="Zoom Slider:" />
                                        <Slider x:Name="Slider_Scale"
                        Minimum="1"
                        Maximum="100"
                        ValueChanged="Slider_Scale_ValueChanged" />
                                        <TextBlock Text="Additional items you can drag in:" />
                                    </StackPanel>
                                </GroupBox>
                            </StackPanel>
                        </dxdo:LayoutPanel>
                    </dxdo:TabbedGroup>
                </dxdo:LayoutGroup>
                  -->

                    <dxdo:LayoutPanel Name="spreadSheetPanel" Caption="Sheet" Padding="0,0,0,25" ShowPinButton="True">
                        <ContentControl Content="{Binding}" ContentTemplate="{StaticResource documents}" x:Name="documentsContainer"/>
                    </dxdo:LayoutPanel>

                </dxdo:LayoutGroup>
            </dxdo:LayoutGroup>

        </dxdo:DockLayoutManager>
    </Grid>
</os:RibbonWindow>
